import yaml
import os
from Ui_Auto_Unittest.common import dir_config


def readYaml(key,filename="testdatas.yaml"):
    filepath = os.path.join(dir_config.testdatas_dir, filename)
    with open(filepath, encoding="utf-8") as yaml_file:
        datas = yaml.load(yaml_file, Loader=yaml.FullLoader)
        data=datas.get(key)
    return data


print(readYaml("login").get('sucess')[0])

print(readYaml("goodsPay").get("goodsname"))
